From d1b0028c88447488166712d9df4be96bc55d050b Mon Sep 17 00:00:00 2001 From: "fred@xuni-t01.sc.intel.com" Date: Tue, 2 Aug 2005 02:09:24 -0800 Subject: [PATCH] Add hypercall continuation support, or else dom_mem_op may fail. Signed-off-by Kevin Tian --- xen/arch/ia64/vmx_hypercall.c | 45 ++++++++++++++++++++++++++++++++++- xen/arch/ia64/xenmisc.c | 2 ++ xen/include/asm-ia64/domain.h | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/vmx_hypercall.c b/xen/arch/ia64/vmx_hypercall.c index fc5f1f8c46..eb9816ad76 100644 --- a/xen/arch/ia64/vmx_hypercall.c +++ b/xen/arch/ia64/vmx_hypercall.c @@ -29,6 +29,7 @@ #include #include #include +#include void hyper_not_support(void) @@ -51,6 +52,42 @@ void hyper_mmu_update(void) vmx_vcpu_increment_iip(vcpu); } +unsigned long __hypercall_create_continuation( + unsigned int op, unsigned int nr_args, ...) +{ + struct mc_state *mcs = &mc_state[smp_processor_id()]; + VCPU *vcpu = current; + struct cpu_user_regs *regs = vcpu_regs(vcpu); + unsigned int i; + va_list args; + + va_start(args, nr_args); + if ( test_bit(_MCSF_in_multicall, &mcs->flags) ) { + panic("PREEMPT happen in multicall\n"); // Not support yet + } else { + vmx_vcpu_set_gr(vcpu, 15, op, 0); + for ( i = 0; i < nr_args; i++) { + switch (i) { + case 0: vmx_vcpu_set_gr(vcpu, 16, va_arg(args, unsigned long), 0); + break; + case 1: vmx_vcpu_set_gr(vcpu, 17, va_arg(args, unsigned long), 0); + break; + case 2: vmx_vcpu_set_gr(vcpu, 18, va_arg(args, unsigned long), 0); + break; + case 3: vmx_vcpu_set_gr(vcpu, 19, va_arg(args, unsigned long), 0); + break; + case 4: vmx_vcpu_set_gr(vcpu, 20, va_arg(args, unsigned long), 0); + break; + default: panic("Too many args for hypercall continuation\n"); + break; + } + } + } + vcpu->arch.hypercall_continuation = 1; + va_end(args); + return op; +} + void hyper_dom_mem_op(void) { VCPU *vcpu=current; @@ -65,7 +102,13 @@ void hyper_dom_mem_op(void) printf("do_dom_mem return value: %lx\n", ret); vmx_vcpu_set_gr(vcpu, 8, ret, 0); - vmx_vcpu_increment_iip(vcpu); + /* Hard to define a special return value to indicate hypercall restart. + * So just add a new mark, which is SMP safe + */ + if (vcpu->arch.hypercall_continuation == 1) + vcpu->arch.hypercall_continuation = 0; + else + vmx_vcpu_increment_iip(vcpu); } diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index b59cb03480..1f2b9c423d 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -103,11 +103,13 @@ while(1); } #endif +#ifndef CONFIG_VTI unsigned long __hypercall_create_continuation( unsigned int op, unsigned int nr_args, ...) { printf("__hypercall_create_continuation: not implemented!!!\n"); } +#endif /////////////////////////////// diff --git a/xen/include/asm-ia64/domain.h b/xen/include/asm-ia64/domain.h index 0b270a7372..7eb2a3f18c 100644 --- a/xen/include/asm-ia64/domain.h +++ b/xen/include/asm-ia64/domain.h @@ -88,6 +88,7 @@ struct arch_vcpu { thash_cb_t *vtlb; char irq_new_pending; char irq_new_condition; // vpsr.i/vtpr change, check for pending VHPI + char hypercall_continuation; //for phycial emulation unsigned long old_rsc; int mode_flags; -- 2.30.2